#include"Student.h"
#include"Teacher.h"
#include<stdio.h>
#include<stdbool.h>
#include<string.h>

bool IsNameEqual(void *p1, void *p2)
{
    Stu *s= (Stu *)p1;
    const char *str=(const char *)p2;
    return strcmp(s->Name, str)==0;
}

bool IsIDEqual(void *p1, void *p2)
{
    Stu *s= (Stu *)p1;
    int *id=(int *)p2;
    return s->id==*id;
}

bool IsNameContains(void *p1, void *p2)
{
    Stu *s=(Stu *)p1;
    const char *str= (const char *)p2;
    if(strstr((const char *)(s->Name),str))
    return true;
    else return false;
}

int main()
{
    Teach t;
    InitTeacher(&t,1,"张三");

    AddStudent(&t,1,"张三");
    AddStudent(&t,2,"王五");
    AddStudent(&t,3,"c五");

    // RemoveStudent(&t,"张三",IsNameEqual);

    // int id=1;
    // RemoveStudent(&t,&id,IsIDEqual);
    // Stu *s= FindStudent(&t,"王五", IsNameEqual);
    // if(s)

    RemoveStudent(&t,"c",IsNameContains);
    PrintTeach(&t);

    // PrintTeach(&t);
    return 0;
}